home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 44
/
Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso
/
-in_the_mag-
/
basics
/
amos
/
checksum.lha
/
checksum.asc
next >
Wrap
Text File
|
1996-09-01
|
632b
|
37 lines
Rem By Patrik Jansson 1/9 1996 FreeWare
Rem Out going mess
Print "Enter an EAN13-cods first 12 digits:"
Rem We need two...
Dim SUM(2)
Rem Input 12 numbers
Do
Input NUM$
Rem 12?
Exit If Len(NUM$)=12
Rem Sorry...
Print "ERROR!"
Loop
Rem lets add those odd and even numbers together!
Do
For E=1 To 2
Inc D
Add SUM(E),Val(Mid$(NUM$,D,1))
If D=>Len(NUM$) Then Exit 2
Next
Loop
Rem the secret is even*3+odd and what ever remains to the next 10 is the
Rem checksum
CHSUM=SUM(1)+SUM(2)*3
CHSUM=10-Val(Right$(Str$(CHSUM),1))
Rem reveal the secret
Print "Checksum digit is:";CHSUM